package com.wx.mall.order.controller;


import com.wx.mall.common.api.CommonResult;
import com.wx.mall.common.vo.order.OrderItemReqVo;
import com.wx.mall.order.entity.OrderItem;
import com.wx.mall.order.service.IOrderItemService;
import com.wx.mall.order.vo.OrderItemPrintReqVo;
import com.wx.mall.order.vo.OrderItemRespVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单项 前端控制器
 * </p>
 *
 * @author j
 * @since 2020-04-13
 */
@Api(tags = "订单项", description = "OrderItemController")
@RestController
@RequestMapping("/order-item")
@Slf4j
public class OrderItemController {

    @Resource
    private IOrderItemService service;


    @ApiOperation("根据订单id查询")
    @GetMapping("/getById")
    public CommonResult<List<OrderItem>> getById(Long orderId){

       List<OrderItem> list=service.getListId(orderId);
        return CommonResult.success(list);
    };

//    暂时不做，等刘杰龙通数据
    @ApiOperation("根据选择中的订单，使用订单id批量查询订单项")
    @PostMapping("/getByIdList")
    public CommonResult<List<OrderItemPrintReqVo>> getByIdList(OrderItemReqVo ids){

        List<OrderItemPrintReqVo> list=service.getByIdList(ids);
        return CommonResult.success(list);
    }

}

